/*
 * Copyright (C) 2013 SeekDeepWithin.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package com.seekdeepwithin.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * User: Jonathan Montiverdi
 * Date: Sep 26, 2013
 *
 *
 */
public class Chapter extends BaseDbObject
{
   private int m_Order;
   private int m_ChapterListId;
   private BaseDbObject m_Footer = null;
   private BaseDbObject m_Header = null;
   private List<Passage> m_Passages;

   /**
    * Initializes a new chapter object.
    * @param id ID of the chapter.
    * @param name Name of the chapter.
    * @param chapterListId The ID of the chapter in the chapter list.
    */
   public Chapter (int id, String name, int chapterListId)
   {
      super (id, name);
      this.m_ChapterListId = chapterListId;
      this.m_Passages = new ArrayList<> ();
   }

   /**
    * Gets the order of the chapter.
    * @return The chapters order.
    */
   public int getOrder ()
   {
      return this.m_Order;
   }

   /**
    * Set the chapters order.
    * @param order Order of chapter.
    */
   public void setOrder (int order)
   {
      this.m_Order = order;
   }

   /**
    * Gets the ID of chapter in the chapter list.
    * @return ID of chapter in the chapter list.
    */
   public int getChapterListId ()
   {
      return this.m_ChapterListId;
   }

   /**
    * Gets the footer.
    * @return The footer object, null if none.
    */
   public BaseDbObject getFooter ()
   {
      return this.m_Footer;
   }

   /**
    * Sets a footer for the chapter.
    * @param id ID of the footer.
    * @param footer Footer data.
    */
   public void setFooter (int id, String footer)
   {
      this.m_Footer = new BaseDbObject (id, footer);
   }

   /**
    * Gets the header.
    * @return The header object, null if none.
    */
   public BaseDbObject getHeader ()
   {
      return this.m_Header;
   }

   /**
    * Sets a header for the chapter.
    * @param id ID of the header.
    * @param header Header data.
    */
   public void setHeader (int id, String header)
   {
      this.m_Header = new BaseDbObject (id, header);
   }

   /**
    * Gets the list of passages.
    * @return The list of passages for the chapter.
    */
   public List<Passage> getPassages ()
   {
      return this.m_Passages;
   }
}
